package com.yc.cloud.mapper;

import com.yc.cloud.entity.UmsAdmin;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 后台用户表 Mapper 接口
 * </p>
 *
 * @author JackGu
 * @since 2022-09-11
 */
@Mapper
public interface UmsAdminMapper extends BaseMapper<UmsAdmin> {

    @Select("SELECT\n" +
            " DISTINCT ar.admin_id\n" +
            "FROM\n" +
            "ums_role_resource_relation rr\n" +
            "LEFT JOIN ums_admin_role_relation ar ON rr.role_id = ar.role_id\n" +
            " WHERE rr.resource_id=#{resourceId}")
    List<Long> getAdminIdList(@Param("resourceId") Long resourceId);

}
